import requests


class TestIHRMDepartApi:
    # 部门添加
    @classmethod
    def test_add_depart_api(cls, token, body):
        url = " http://ihrm2-test.itheima.net/api/company/department"
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.post(url=url, headers=header, json=body)
        return resp

    # 部门查询
    @classmethod
    def test_query_depart_api(self, depart_id, token):
        url = "http://ihrm2-test.itheima.net/api/company/department/" + depart_id
        header = {"Authorization": token}
        resp = requests.get(url=url, headers=header )
        return resp

    # 部门修改
    @classmethod
    def test_modify_depart_api(cls, depart_id, token,body):
        url = "http://ihrm2-test.itheima.net/api/company/department/" + depart_id
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.put(url=url, headers=header, json=body)
        return resp

    # 删除部门
    @classmethod
    def test_depart_api(cls, depart_id, token):
        url = "http://ihrm2-test.itheima.net/api/company/department/" + depart_id
        header = {"Authorization": token}
        resp = requests.delete(url=url, headers=header)
        return resp
